package org.lex.splitter.ui.awt;

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class AwtSplit {

	private static final AwtSplit application = new AwtSplit();

	public static void main(String[] args) {
		getApplication().run();
	}

	public static AwtSplit getApplication() {
		return application;
	}

	private Frame mainFrame = null;
	private SplitContentPane contentPane = null;

	public void run() {
		this.getMainFrame().setVisible(true);
	}

	public Frame getMainFrame() {
		if (null == mainFrame) {
			mainFrame = new Frame();
			mainFrame.add(this.getContentPane());

			mainFrame.setTitle("Splitter");
			mainFrame.setLocationRelativeTo(null);
			mainFrame.addWindowListener(new WindowAdapter() {
				public void windowClosing(WindowEvent e) {
					getMainFrame().dispose();
				}
			});

			mainFrame.setSize(300, 180);
		}
		return mainFrame;
	}

	public SplitContentPane getContentPane() {
		if (null == contentPane) {
			contentPane = new SplitContentPane();
		}
		return contentPane;
	}
}
